
#ifndef __IPEDIT_H__
#define __IPEDIT_H__
#include "..\DuiLib\UIlib.h"

using namespace DuiLib;

class CIPEditWnd;

#define DotWidth 5
#define EditColor 
class  CIPEditUI : public CLabelUI
{
public:
	CIPEditUI();
	LPCTSTR GetClass() const;
	UINT GetControlFlags() const;
	void SetEnabled(bool bEnable = true);
	void SetText(LPCTSTR pstrText);
	void SetMaxChar(UINT uMax);
	UINT GetMaxChar();
	int GetWindowStyls() const;
	//LPCTSTR GetNormalImage();
	//void SetNormalImage(LPCTSTR pStrImage);
	//LPCTSTR GetHotImage();
	//void SetHotImage(LPCTSTR pStrImage);
	//LPCTSTR GetFocusedImage();
	//void SetFocusedImage(LPCTSTR pStrImage);
	//LPCTSTR GetDisabledImage();
	void SetDisabledImage(LPCTSTR pStrImage);
	void SetNativeEditBkColor(DWORD dwBkColor);
	DWORD GetNativeEditBkColor() const;

	void SetSel(long nStartChar, long nEndChar);
	void SetSelAll();
	void SetReplaceSel(LPCTSTR lpszReplace);

	void SetPos(RECT rc);
	void SetVisible(bool bVisible = true);
	void SetInternVisible(bool bVisible = true);
	SIZE EstimateSize(SIZE szAvailable);
	void DoEvent(TEventUI& event);

	void PaintStatusImage(HDC hDC);
	void PaintText(HDC hDC);
	void SetNextEdit(CIPEditUI*& pEdit);
	void SetFrontEdit(CIPEditUI* pEdit);
	void SetTextColor(DWORD dwColor);
protected:
	CIPEditWnd* m_pWindow;
	
	UINT m_uButtonState;
	CDuiString m_sNormalImage;
	CDuiString m_sHotImage;
	CDuiString m_sFocusedImage;
	CDuiString m_sDisabledImage;
	DWORD m_dwEditbkColor;
	int m_iWindowStyls;
private:
	friend class CIPEditWnd;
	CIPEditUI* m_pNextEdit;
	CIPEditUI* m_pFrontEdit;
	DWORD m_dwTextColor;

};



class CIPAddress :public CContainerUI
{
	friend class CIPEditUI;
public:
	CIPAddress();
	LPCTSTR GetClass()const;
	LPVOID GetInterface();
	CDuiString GetIPText()const;
	UINT GetIP()const;
	void SetIPText(UINT nIP);
	void SetAttribute(LPCTSTR pstrName ,LPCTSTR pstrValue);
	void SetPos(RECT rcPos);
	void SetBkColor(DWORD dwColor);
	void InitEditItem();
	//void SetPadding(RECT rcPadding);
	//void SetFixedWidth(int cx);
	//void SetFixedHeight(int cy);
	//void DoEvent(TEventUI& event);
	void AdjustPos();
	void SetFont(int nnFont);
	void SetTextColor(DWORD dwColor);
	void SetBkImage(LPCTSTR pstrImage);
	//void DoEvent(TEventUI& event);
private:
	int m_nWidth;
	int m_nHeight;
	CContainerUI* m_pIP;
	CIPEditUI* m_pEditItem[4];
	CContainerUI* m_pParent;
	RECT m_rcPanel;
	RECT ResetItem(CIPEditUI* pItem ,int nIndex);
};
#endif // __IPEDIT_H__